<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<script type="text/javascript">
    $(function() {
        $("#vto1").datepicker({
            dateFormat: 'dd-mm-yy'
        });
        $("#vto2").datepicker({
            dateFormat: 'dd-mm-yy'
        });
      });
    
</script>
<form action="<?php echo url_for('periodo/' . ($form->getObject()->isNew() ? 'create' : 'update') . (!$form->getObject()->isNew() ? '?id=' . $form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
    <?php if (!$form->getObject()->isNew()): ?>
        <input type="hidden" name="sf_method" value="put" />
    <?php endif; ?>
  
    <table class="formulario" width="98%"  >
        <tbody>
            <?php echo $form->renderGlobalErrors() ?>
             <?php if ($sf_user->hasFlash('errorvto')): ?>
              <tr>
               <th ></th>
                <td ><div  class="errorLogin" ><?php echo $sf_user->getFlash('errorvto') ?></div>
                 <td >   
                </td>
                
            </tr>
            <?php endif; ?>
            <tr>
                <th ><?php echo $form['mes']->renderLabel() ?></th>
                <td >
                    <?php echo $form['mes']->renderError() ?>
                    <?php echo $form['mes'] ?>
                </td>
            </tr>
            <tr>
                <th><?php echo $form['anio']->renderLabel() ?></th>
                <td>
                    <?php echo $form['anio']->renderError() ?>
                    <?php echo $form['anio'] ?>
                </td>
            </tr>
            <tr>
                <th style="color: #000">Primer Vencimiento</th>
                <td>
                 <input name="vto1" id="vto1" value="<?php echo (count($vtos) >0) ? $vtos[0] : ""   ?>">
                </td>
            </tr>
            <tr>
                <th style="color: #000">Segundo Vencimiento</th>
                <td>
                    <input name="vto2" id="vto2" value="<?php echo (count($vtos) ==2) ? $vtos[1] : "" ?>">
                </td>
            </tr>
            <tr style="display:none">
                <th  ><?php echo $form['tipo_impuesto_id']->renderLabel() ?></th>
                <td>
                    <?php echo $form['tipo_impuesto_id']->renderError() ?>
                    <?php echo $form['tipo_impuesto_id'] ?> 
                </td>
            </tr>
            <tr style="display:none">
        <th ><?php echo $form['cerrada']->renderLabel() ?></th>
        <td>
          <?php echo $form['cerrada']->renderError() ?>
          <?php echo $form['cerrada']->render(array("value"=>"0"))?>
        </td>
      </tr>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="2">
                    <?php echo $form->renderHiddenFields(false) ?>
                    &nbsp;<a style=" text-decoration:none;   "href="<?php echo url_for('periodo/index') ?>">Volver</a>

                    <input type="submit" value="Aceptar" onmouseover="style.cursor=cursor"/>
                </td>
            </tr>
        </tfoot>
    </table>
</form>
